﻿<%@ Page Title="View Product Category Page" Language="C#" MasterPageFile="  ~/template/Site.Master" AutoEventWireup="true" CodeBehind="ViewProductCategory.aspx.cs" Inherits="EAAdmin.ViewProductCategory" %>

<%@ Import Namespace="EA.DTO" %>
<%@ Import Namespace="EA.Common" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <form id="form1" runat="server">
        <div class="page_name">List Of Category</div>
        <div class="error">
            <%                
                String alert = "";
                if (Attributes.ContainsKey("err"))
                {
                    alert = (String)Attributes["err"];
            %>
            <div class="message">
                <div><%=alert%></div>
            </div>
            <%  }
                if (Attributes.ContainsKey("success"))
                {
                    alert = (String)Attributes["success"];
            %>
            <div class="message_alert">
                <div><%=alert%></div>
            </div>
            <%  } %>
        </div>

        <table class="table">
            <tr>
                <th>Id</th>
                <th>Name</th>
                <th>Created Date</th>
                <th>Updated Date</th>
                <th>Status</th>
            </tr>
            <% List<ProductCategoryTO> listProductCategory = (List<ProductCategoryTO>)Attributes["listProductCategory"]; %>
            <%for (int i = 0; i < listProductCategory.Count; i++)
              { %>
            <tr>
                <td><%=listProductCategory[i].ID %></td>
                <td><%=listProductCategory[i].Name %></td>
                <td><%=listProductCategory[i].CreateDate%>
                <td>
                    <%
                  if (listProductCategory[i].UpdateDate == null)
                  {
                      listProductCategory[i].UpdateDate = listProductCategory[i].CreateDate;
                  }
                    %>

                    <%=listProductCategory[i].CreateDate%>
                </td>
                <td><%
                  if (listProductCategory[i].Status == Constant.PRODUCT_CATEGORY_ACTICE)
                  {%>
                    <a>Active</a>
                    <%}
                  else if (listProductCategory[i].Status == Constant.PRODUCT_CATEGORY_NOT_ACTIVE)
                  { %>
                    <a>Not active</a><%} %>
                    <%if (listProductCategory[i].Status == Constant.PRODUCT_CATEGORY_ACTICE)
                      { %>

                    <a href="/ViewProductCategory.aspx?action=Delete&id=<%=listProductCategory[i].ID %>" style="margin-right: 5px; float: right">
                        <img src="/public/images/cross.png" />
                    </a>
                    <%} %>
                    <a href="/EditProductCategory.aspx?id=<%=listProductCategory[i].ID %>" style="margin-right: 5px; float: right">
                        <img src="/public/images/pencil.png" />
                    </a>
                </td>
            </tr>
            <%} %>
        </table>
    </form>
</asp:Content>
